home *** CD-ROM | disk | FTP | other *** search
/ Greenhouse Effect Detection Expriment / NASA Greenhouse Effect Detection Expriment 1992 - Disc 2.iso / software / dos / cdf22pc / src / tools / window.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-29  |  18.8 KB  |  914 lines

  1. /******************************************************************************
  2. *
  3. *  NSSDC/CDF                           Windowing functions.
  4. *
  5. *  Version 2.0, 29-Feb-92, ST Systems (STX)
  6. *
  7. *  Modification history:
  8. *
  9. *   V1.0  29-Jan-91, H Leckner   Original version (for CDF V2.0).
  10. *   V1.1   4-Aug-91, J Love      TRUE/FALSE.  Minor change to borders (well
  11. *             H Leckner   maybe).
  12. *   V1.2  13-Aug-91, H Leckner   Fixed border labeling.
  13. *   V1.3   8-Oct-91, J Love      Modified for IRIX 4.0 port, etc.
  14. *                    H Leckner
  15. *   V2.0  29-Feb-92, H Leckner     CDF V2.2.  IBM PC port.
  16. *
  17. ******************************************************************************/
  18.  
  19. #ifdef vms
  20. #include <stdio.h>
  21. #include <descrip.h>
  22.   /*
  23.    *    MODULE:        SMG_GLUE_C.C
  24.    */
  25.  
  26. #define KEYPADBUG (0)
  27.  
  28. #include <smgdef.h>
  29. #include <ssdef.h>
  30.  
  31.                /*CodeRef-mark*/
  32.  
  33. /*   Additions to SMG_GLUE_C.C --
  34.  *   Set- and Get- physical cursor added, Dan Grogan, October 1988.
  35.  */
  36.                /*CodeRef-mark*/
  37.  
  38.                /*CodeRef-mark*/
  39. long int    pbid;
  40. long int    kbid;
  41. long get_physical_cursor (row, col)
  42.  
  43.        long int    *row;
  44.        long int    *col;
  45. {
  46.                /*CodeRef-mark*/
  47.        long int    status;
  48.        long int    smg$get_physical_cursor();
  49.        status = smg$get_physical_cursor (&pbid, row, col);
  50. }
  51.  
  52.                /*CodeRef-mark*/
  53. long set_physical_cursor (row, col)
  54.        long int    row;
  55.        long int    col;
  56. {
  57.                /*CodeRef-mark*/
  58.        long int    status;
  59.        long int    smg$set_physical_cursor();
  60.        status = smg$set_physical_cursor (&pbid, &row, &col);
  61. }
  62.  
  63.  
  64. create_virtual_display ( num_rows, num_cols, vid, disp_type, video_type )
  65.        long int    num_rows;
  66.        long int    num_cols;
  67.        long int    *vid;
  68.        long int    disp_type;
  69.        long int    video_type;
  70. {
  71.        long int    status;
  72.        long int    smg$create_virtual_display();
  73.        status = smg$create_virtual_display (&num_rows, &num_cols,
  74.        vid, &disp_type, &video_type);
  75. }
  76. delete_virtual_display ( vid )
  77.        long int    vid;
  78. {
  79.        long int    status;
  80.        long int    smg$delete_virtual_display();
  81.  
  82.        status = smg$delete_virtual_display ( &vid );
  83. }
  84.  
  85. change_virtual_display ( num_rows, num_cols, vid, disp_type, video_type )
  86.        long int    num_rows;
  87.        long int    num_cols;
  88.        long int    vid;
  89.        long int    disp_type;
  90.        long int    video_type;
  91. {
  92.        long int    status;
  93.        long int    smg$change_virtual_display();
  94.  
  95.        status = smg$change_virtual_display (&vid, &num_rows, &num_cols,
  96.        &disp_type, &video_type);
  97. }
  98.  
  99. begin_pasteboard_update()
  100. {
  101.        long int    status;
  102.        long int    smg$begin_pasteboard_update();
  103.  
  104.        status = smg$begin_pasteboard_update(&pbid);
  105. }
  106. end_pasteboard_update()
  107. {
  108.        long int    status;
  109.        long int    smg$end_pasteboard_update();
  110.  
  111.        status = smg$end_pasteboard_update(&pbid);
  112. }
  113.  
  114.  
  115. paste_virtual_display(vid, row, col)
  116.        long int    vid;
  117.        long int    row;
  118.        long int    col;
  119. {
  120.        long int    status;
  121.        long int    smg$paste_virtual_display();
  122.        status = smg$paste_virtual_display(&vid, &pbid, &row, &col);
  123. /*    if(status != SS$_NORMAL)lib$signal(status);*/
  124.  
  125. }
  126. unpaste_virtual_display(vid)
  127.        long int    vid;
  128. {
  129.        long int    status;
  130.        long int    smg$unpaste_virtual_display();
  131.  
  132.        status = smg$unpaste_virtual_display(&vid, &pbid);
  133. }
  134. change_rendition ( vid, row, col, num_rows, num_cols, on_or_off)
  135.        long int    vid;
  136.        long int    row;
  137.        long int    col;
  138.        long int    num_rows;
  139.        long int    num_cols;
  140.        long int    on_or_off;
  141. {
  142.        long int    status;
  143.        long int    smg$change_rendition();
  144.        status = smg$change_rendition (&vid, &row, &col,
  145.         &num_rows, &num_cols, &on_or_off);
  146. }
  147. return_cursor_pos ( vid, row, col)
  148.        long int    vid;
  149.        long int    *row;
  150.        long int    *col;
  151. {
  152.        long int    status;
  153.        long int    smg$return_cursor_pos();
  154.        status = smg$return_cursor_pos (&vid, row, col);
  155. }
  156. set_cursor_abs ( vid, row, col)
  157.        long int    vid;
  158.        long int    row;
  159.        long int    col;
  160. {
  161.        long int    status;
  162.        long int    smg$set_cursor_abs();
  163.        status = smg$set_cursor_abs (&vid, &row, &col);
  164. }
  165. set_cursor_rel ( vid, num_rows, num_cols)
  166.        long int    vid;
  167.        long int    num_rows;
  168.        long int    num_cols;
  169. {
  170.        long int    status;
  171.        long int    smg$set_cursor_rel();
  172.        status = smg$set_cursor_rel (&vid, &num_rows, &num_cols);
  173. }
  174. repaint_screen()
  175. {
  176.        long int    status;
  177.        long int    smg$repaint_screen();
  178.  
  179.        status = smg$repaint_screen(&pbid);
  180. }
  181. delete_pasteboard(erase)
  182.        long int    erase;
  183. {
  184.        long int    status;
  185.        long int    smg$delete_pasteboard();
  186.  
  187.        status = smg$delete_pasteboard(&pbid, &erase);
  188. }
  189.  
  190. ring_bell (vid)
  191.        long int    vid;
  192. {
  193.        long int    status;
  194.        long int    smg$ring_bell();
  195.  
  196.        status = smg$ring_bell(&vid);
  197. }
  198.  
  199.  
  200.   /*
  201.    *     <dan> new functions
  202.    */
  203.  
  204.  
  205. long int set_cursor_mode (cursorMode)
  206.      long int         cursorMode;
  207. {
  208.   /*
  209.    *              pbid is a pasteboard id.
  210.    *              cursorMode  =   0  : cursor ON, visible.
  211.    *                          =   1  : cursor OFF, invisible.
  212.    */
  213.      long int         status;
  214.      long int         smg$set_cursor_mode();
  215.  
  216.      status = smg$set_cursor_mode (&pbid, &cursorMode);
  217. }
  218.  
  219.  
  220. long int scroll_display_area (vid)
  221.  
  222.      long int vid;
  223. {
  224.      long int startRow = 1, startCol = 2;
  225.      long int height = 3, width = 1, direction = SMG$M_DOWN,
  226.            count = 1;
  227.  
  228.      long int  status;
  229.      long int  smg$scroll_display_area();
  230.  
  231.      status = smg$scroll_display_area (&vid, &startRow, &startCol,
  232.                        &height, &width, &direction,
  233.                        &count);
  234. }
  235.  
  236.  
  237. long int erase_display (vid, startRow, startCol, endRow, endCol)
  238.      long int vid, startRow, startCol, endRow, endCol;
  239.  
  240. {
  241.      long int status;
  242.     status = smg$erase_display (&vid, &startRow, &startCol,
  243.                          &endRow, &endCol);
  244. }
  245.  
  246.  
  247. long int begin_display_update(vid)
  248.        long int    vid;
  249. {
  250.        long int    status;
  251.        long int    smg$begin_display_update();
  252.  
  253.        status = smg$begin_display_update(&vid);
  254. }
  255.  
  256.  
  257. long int end_display_update(vid)
  258.        long int    vid;
  259. {
  260.        long int    status;
  261.        long int    smg$end_display_update();
  262.  
  263.        status = smg$end_display_update(&vid);
  264. }
  265.  
  266.  
  267. long int set_keypad_mode (mode)
  268.      long int mode;
  269. {
  270.        long int    status;
  271.        long int    smg$set_keypad_mode();
  272.  
  273. /*  mode 0 is numeric keypad;  mode 1 is applications functions pad */
  274.     status = smg$set_keypad_mode (&kbid, &mode);
  275.  
  276.  
  277. }
  278. put_chars(vdid, string, len, row, col, erase, video_type)
  279. long int       vdid;
  280. char           string[];
  281. long int       len;
  282. long int       row;
  283. long int       col;
  284. long int       erase;
  285. long int       video_type;
  286. {
  287. long int       status;
  288. static char    temp[512];
  289. static $DESCRIPTOR(string_desc, temp);
  290.  
  291. strcpy(temp, string);
  292. string_desc.dsc$w_length = len;
  293. status = smg$put_chars(&vdid, &string_desc, &row, &col, &erase, &video_type);
  294. }
  295. label_border(vdid, string, len)
  296. long int       vdid;
  297. char           string[];
  298. long int       len;
  299. {
  300. static char    temp[512];
  301. long int       video_type = SMG$M_REVERSE;
  302. long int       status;
  303. static $DESCRIPTOR(string_desc, temp);
  304.  
  305. strcpy(temp, string);
  306. string_desc.dsc$w_length = len;
  307.  
  308. status = smg$label_border(&vdid, &string_desc, NULL, NULL, &video_type);
  309. }
  310. create_pasteboard ()
  311. {
  312. long int       tot_rows;
  313. long int       tot_cols;
  314. long int       clear_flags = 0;
  315. long int       status;
  316. long int       temp;
  317. status = smg$create_pasteboard(&temp, NULL, &tot_rows,
  318.        1       &tot_cols, &clear_flags);
  319. if(status != SS$_NORMAL)lib$signal(status);
  320. pbid = temp;
  321. status = smg$create_virtual_keyboard(&temp, NULL, NULL, NULL, NULL);
  322. if(status != SS$_NORMAL)lib$signal(status);
  323. kbid = temp;
  324. }
  325. read_input(tcode)
  326. long int       *tcode;
  327. {
  328. short int      temp_code;
  329. long int       status;
  330.  
  331. /*
  332. READ a character from the keyboard
  333. */
  334. status = smg$read_keystroke(&kbid, &temp_code, NULL, NULL, NULL, NULL, NULL);
  335. *tcode  = temp_code;
  336. }
  337. read_display(vdid, row, string)
  338. long int       vdid;
  339. long int       row;
  340. char           string[];
  341. {
  342. long int       status;
  343. static char    temp[80];
  344. long int       len;
  345. long int       i;
  346. static $DESCRIPTOR(string_desc, temp);
  347. for(i=0; i<80; i++)
  348.     temp[i] = ' ';
  349. status=smg$read_from_display(&vdid, &string_desc, NULL, &row);
  350. strcpy(string, temp);
  351. }
  352. save_screen(save_id)
  353. long int       *save_id;
  354. {
  355. long int       status;
  356. long int       smg$save_physical_screen();
  357. status = smg$save_physical_screen(&pbid, save_id);
  358. }
  359. restore_screen(save_id)
  360. long int       save_id;
  361. {
  362. long int       status;
  363. long int       smg$restore_physical_screen();
  364. status = smg$restore_physical_screen(&pbid, &save_id);
  365. }
  366. ast_routine(pbid_arr)
  367. long int       pbid_arr[];
  368. {
  369. static char    message[512];
  370. long int       pbid;
  371. long int       message_vdid;
  372. short int      mess_len;
  373. long int       row, col;
  374. long int       status;
  375. static $DESCRIPTOR(message_desc, message);
  376.  
  377. pbid = pbid_arr[0];
  378. message_vdid = pbid_arr[1];
  379.  
  380. status = smg$get_physical_cursor (&pbid, &row, &col);
  381. status = smg$get_broadcast_message(&pbid, &message_desc,&mess_len);
  382. status = smg$put_line(&message_vdid, &message_desc);
  383. status = smg$ring_bell(&message_vdid);
  384. status = smg$set_physical_cursor (&pbid, &row, &col);
  385. }
  386. enable_trap (mess_vid)
  387. long int       mess_vid;
  388. {
  389. static long int    pbid_arr[2];
  390.  
  391. long int       status;
  392. long int       ast_routine();
  393.  
  394. pbid_arr[0] = pbid;
  395. pbid_arr[1] = mess_vid;
  396.  
  397. status = smg$set_broadcast_trapping(&pbid, ast_routine,    pbid_arr);
  398. }
  399. #endif
  400.  
  401. #if defined(unix) | defined(__MSDOS__)
  402. /*
  403. Replacement for VAX screen manager WFL glue layer
  404. Changes:
  405.  
  406. put_chars: now in C therefore when it is called arguments should not be
  407.       passed by value
  408. read_input: argument changed to long integer vdid for curses for the current
  409.        window that is used to be read from (kbid is not used in curses
  410. */
  411. #include "window.h"
  412.  
  413. /* #define A_NORMAL 0 TEST A_NORMAL is not in PCCURS14 */
  414. /* #define A_BOLD 0x4000 add to window.h ************/
  415. #define DUMMY 0
  416.  
  417. /* Global variables (local to this source file). */
  418.  
  419. static WINDOWid        window_on_screen[100];
  420. static long        num_window_on_screen;
  421.  
  422. struct         all_win_struct {
  423. WINDOWid       window_id;
  424. int            video_type;
  425. } static all_windows[100];
  426.  
  427. static long        num_windows;
  428. static long        UPDATE_WINDOW;
  429.  
  430.  
  431. /** End of global variables. */
  432.  
  433. void create_pasteboard ()
  434. {
  435. initscr();
  436. cbreak();
  437. noecho();
  438. wattrset(stdscr, A_NORMAL);
  439. UPDATE_WINDOW = TRUE;
  440. num_windows = 0;
  441. num_window_on_screen = 0;
  442. }
  443. #if 0 /*jtl*/
  444. void set_cursor_mode(pbid, mode)
  445. int        pbid;
  446. int        mode;
  447. {
  448. pbid = DUMMY;
  449. mode = DUMMY;
  450. /*curs_set(mode);*/
  451. }
  452. #endif /*jtl*/
  453.  
  454. int window_attribute(window_id)
  455. WINDOWid  window_id;
  456. {
  457. int i;
  458. for (i=0; i<num_windows; i++)
  459.   {
  460.   if(window_id == all_windows[i].window_id)return(all_windows[i].video_type);
  461.   }
  462. return(NORMAL);
  463. }
  464. void put_chars(vdid, str, len, row, col, erase_line, video_type)
  465. WINDOWid vdid;
  466. char     str[];
  467. int      len;
  468. int      row;
  469. int      col;
  470. int      erase_line;
  471. int      video_type;
  472. {
  473. /*int      status;*/
  474. char       temp[512];
  475. int    i /*,x,y*/ ;
  476. register WINDOWid      vdp = vdid;
  477. register char      *s;
  478. int maxx;
  479. #if defined(unix) | defined(__MSDOS__)
  480. maxx = vdp->_maxx;
  481. #else
  482. maxx = vdp->cols;
  483. #endif
  484.  
  485. if(erase_line)
  486.    {
  487.    s = temp;
  488.    for(i=0; i< maxx-2; i++)
  489.        *s++ = ' ';
  490.    *s = '\0';
  491.    wattrset(vdp, A_NORMAL);
  492.    mvwaddstr(vdp, row, 1, temp);
  493.    }
  494.  
  495.  
  496. switch(video_type)
  497.        {
  498.        case NORMAL:
  499.        case BOLD:
  500.        if(window_attribute(vdp) == NORMAL)
  501. #if defined(__MSDOS__)
  502.      wattrset(vdp, A_HIGH|F_BROWN|B_BLUE);
  503. #else
  504.      wattrset(vdp, A_NORMAL);
  505. #endif
  506.        else
  507. #if defined(__MSDOS__)
  508.      wattrset(vdp, A_HIGH|F_GRAY|B_BLUE);
  509. #else
  510.      wattrset(vdp, A_NORMAL | A_BOLD);
  511. #endif
  512.        break;
  513.  
  514.        case REVERSE:
  515.        if(window_attribute(vdp) == NORMAL)
  516. #if defined(__MSDOS__)
  517.      wattrset(vdp, F_BROWN|B_GRAY);
  518. #else
  519.      wattrset(vdp, A_REVERSE | A_NORMAL);
  520. #endif
  521.        else
  522. #if defined(__MSDOS__)
  523.      wattrset(vdp, A_HIGH|F_BROWN|B_GRAY);
  524. #else
  525.      wattrset(vdp, A_REVERSE | A_BOLD);
  526. #endif
  527.        break;
  528.  
  529.        case BLINK:
  530.        if(window_attribute(vdp) == NORMAL)
  531. #if defined(__MSDOS__)
  532.      wattrset(vdp, A_BLINK|F_BROWN|B_BLUE);
  533. #else
  534.      wattrset(vdp, A_BLINK | A_NORMAL);
  535. #endif
  536.        else
  537. #if defined(__MSDOS__)
  538.      wattrset(vdp, A_BLINK|F_GRAY|B_BLUE);
  539. #else
  540.      wattrset(vdp, A_BLINK | A_BOLD);
  541. #endif
  542.        break;
  543.        default:
  544.        break;
  545.        }
  546.  
  547. s = temp;
  548. for(i=0; i< len; i++)
  549.     *s++ = str[i];
  550. *s = '\0';
  551.  
  552. mvwaddstr(vdp, row, col, temp);
  553.  
  554. if(UPDATE_WINDOW)
  555.    {
  556.    wrefresh(vdp);
  557.    wattrset(vdp, A_NORMAL);
  558.    }
  559. }
  560.  
  561. void create_virtual_display(num_rows, num_cols, vdid, disp_type, video_type)
  562. int    num_rows;
  563. int    num_cols;
  564. WINDOWid       *vdid;
  565. int    disp_type;
  566. int    video_type;
  567. {
  568. /*int    status;*/
  569. /*char       temp[81];*/
  570. WINDOWid       vdp;
  571. vdp = newwin(num_rows, num_cols, 0, 0);
  572. keypad(vdp, TRUE);
  573.  
  574. if(video_type == BOLD || video_type == NORMAL)        /* | --> || */
  575.    wattrset(vdp, A_NORMAL);
  576. if(disp_type == BORDER)
  577.    touchwin(vdp);
  578.  
  579.  
  580. *vdid = vdp;
  581. all_windows[num_windows].window_id = vdp;
  582. all_windows[num_windows].video_type = video_type;
  583. num_windows++;
  584. }
  585.  
  586. void paste_virtual_display(vdid, row, col)
  587. WINDOWid       vdid;
  588. int        row;
  589. int        col;
  590. {
  591. #if defined(unix) | defined(__MSDOS__)
  592. vdid->_begy = row;
  593. vdid->_begx = col;
  594. #else
  595. vdid->oy = row;
  596. vdid->ox = col;
  597. #endif
  598. touchwin(vdid);
  599. if(UPDATE_WINDOW)
  600.   {
  601. #if defined(__MSDOS__)
  602.   wattrset(vdid, A_NORMAL);
  603.   box(vdid, '│', '─');
  604. #else
  605.   wattrset(vdid, A_NORMAL);
  606.   box(vdid, 0, 0);
  607. #endif
  608.   wrefresh(vdid);
  609.   }
  610. window_on_screen[num_window_on_screen++] = vdid;
  611.  
  612. }
  613.  
  614. /*
  615. Routine so when we are redraw something that is already on the screen
  616. the window_on_screen will not be added to, therefore not having duplicates
  617. */
  618. void repaste_virtual_display(vdid, row, col)
  619. WINDOWid       vdid;
  620. int        row;
  621. int        col;
  622. {
  623. #if defined (unix) | defined(__MSDOS__)
  624. vdid->_begy = row;
  625. vdid->_begx = col;
  626. #else
  627. vdid->oy = row;
  628. vdid->ox = col;
  629. #endif
  630. touchwin(vdid);
  631. if(UPDATE_WINDOW)
  632.   {
  633. #if defined(__MSDOS__)
  634.   wattrset(vdid, A_NORMAL);
  635.   box(vdid, '│', '─');
  636. #else
  637.   box(vdid, 0, 0);
  638. #endif
  639.   wrefresh(vdid);
  640.   }
  641. }
  642.  
  643. void change_virtual_display(num_rows, num_cols, vdid, disp_type, video_type)
  644. int        num_rows;
  645. int        num_cols;
  646. WINDOWid       *vdid;
  647. int        disp_type;
  648. int        video_type;
  649. {
  650. int        row,col;
  651. row = ((WINDOW *)(*vdid))->_begy;
  652. col = ((WINDOW *)(*vdid))->_begx;
  653. werase(*vdid);
  654. delwin(*vdid);
  655. *vdid = newwin(num_rows, num_cols, row, col);
  656. keypad((*vdid), TRUE);
  657. if(video_type == BOLD || video_type == NORMAL)        /* | --> || */
  658.    wattrset(*vdid, A_NORMAL);
  659. if(disp_type == BORDER)
  660.    touchwin(*vdid);
  661.  
  662. }
  663. void delete_virtual_display(vdid)
  664. WINDOWid       vdid;
  665. {
  666. int i;
  667. werase(vdid);
  668. wnoutrefresh(vdid);
  669. delwin(vdid);
  670. num_window_on_screen--;
  671. for(i=0; i<num_window_on_screen; i++)
  672.   {
  673.     touchwin(window_on_screen[i]);
  674.     wnoutrefresh(window_on_screen[i]);
  675.   }
  676.  doupdate();
  677. }
  678. void unpaste_virtual_display(vdid)
  679. WINDOWid       vdid;
  680. {
  681. int i;
  682. werase(vdid);
  683. wnoutrefresh(vdid);
  684. num_window_on_screen--;
  685. for(i=0; i<num_window_on_screen; i++)
  686.   {
  687.     touchwin(window_on_screen[i]);
  688.     wnoutrefresh(window_on_screen[i]);
  689.   }
  690.  doupdate();
  691. }
  692. void unpaste_virtual_display_only(vdid)
  693. WINDOWid       vdid;
  694. {
  695. /*int i;*/
  696. werase(vdid);
  697. wrefresh(vdid);
  698. }
  699. void label_border(vdid, byte_string, len)
  700. WINDOWid       vdid;
  701. char           byte_string[];
  702. int            len;
  703. {
  704. /*char           temp[81];*/
  705. /*int            offset;*/
  706. int            row = 0;
  707. int            col;
  708. /*int            rcode;*/
  709. int maxx;
  710.  
  711. if(window_attribute(vdid) == NORMAL)
  712. #if defined(__MSDOS__)
  713.      wattrset(vdid, F_BROWN|B_GRAY);
  714. #else
  715.      wattrset(vdid, A_REVERSE | A_NORMAL);
  716. #endif
  717. else
  718. #if defined(__MSDOS__)
  719.      wattrset(vdid, A_HIGH | F_BROWN|B_GRAY);
  720. #else
  721.      wattrset(vdid, A_REVERSE | A_BOLD);
  722. #endif
  723. #if defined (unix) | defined(__MSDOS__)
  724. maxx = vdid->_maxx;
  725. #else
  726. maxx = vdid->cols;
  727. #endif
  728. col = (maxx - len) / 2 + 1;
  729. mvwaddstr(vdid, row, col, byte_string);
  730. /*
  731. Caller must call label_border after window is pasted
  732. */
  733. wrefresh(vdid);
  734.  
  735. wattrset(vdid,A_NORMAL);
  736. }
  737. void delete_pasteboard (erase_mode)
  738. int                erase_mode;
  739. {
  740. if(erase_mode)
  741.   {
  742.   werase(stdscr);
  743.   wrefresh(stdscr); 
  744.   }
  745. endwin();
  746. }
  747. void read_input(vdid, tcode)
  748. WINDOWid       vdid;
  749. int            *tcode;
  750. {
  751. int            temp;
  752. temp = wgetch(vdid);
  753. *tcode = temp;
  754. }
  755. void set_cursor_abs(vdid, row, col)
  756. WINDOWid       vdid;
  757. int    row;
  758. int    col;
  759. {
  760. wmove(vdid, row, col);
  761. if(UPDATE_WINDOW)wrefresh(vdid);
  762. }
  763. void change_rendition(vdid, row, col, num_rows, num_cols, video_type)
  764. WINDOWid       vdid;
  765. int    row;
  766. int    col;
  767. int    num_rows;
  768. int    num_cols;
  769. int    video_type;
  770. {
  771. int    i,j;
  772. char       temp[80];
  773. for(j=0; j<num_rows; j++)
  774.     {
  775.     for(i=0; i<num_cols; i++)
  776.        temp[i] = mvwinch(vdid, row+j, col+i);
  777.     temp[num_cols] = '\0';
  778.     put_chars(vdid, temp, num_cols, row+j, col, 0, video_type);
  779.     }
  780. }
  781. void read_display(vdid, row, s)
  782. WINDOWid       vdid;
  783. int    row;
  784. char       *s;
  785. {
  786. int    i /*,j*/ ;
  787. int maxx;
  788. #if defined(unix) | defined(__MSDOS__)
  789. maxx = vdid->_maxx;
  790. #else
  791. maxx = vdid->cols;
  792. #endif
  793.  
  794. for(i=1; i<maxx; i++)
  795.        *s++ = mvwinch(vdid, row, i);
  796. *s = '\0';
  797. }
  798. void begin_display_update(vdid)
  799. WINDOWid       vdid;
  800. {
  801. #if defined(__MSDOS__)
  802. touchwin(vdid);
  803. #endif
  804. UPDATE_WINDOW = FALSE;
  805. }
  806. void end_display_update(vdid)
  807. WINDOWid       vdid;
  808. {
  809. UPDATE_WINDOW = TRUE;
  810. wattrset(vdid, A_NORMAL);
  811. #if defined(__MSDOS__)
  812.   box(vdid, '│', '─');
  813. #else
  814.   box(vdid, 0, 0);
  815. #endif
  816. wrefresh(vdid);
  817. }
  818. void end_display_update_nobox(vdid)
  819. WINDOWid       vdid;
  820. {
  821. UPDATE_WINDOW = TRUE;
  822. wattrset(vdid, A_NORMAL);
  823. wrefresh(vdid);
  824. }
  825. void repaint_screen()
  826. {
  827. wrefresh(curscr);
  828. }
  829. void ring_bell()
  830. {
  831. beep();
  832. }
  833. void erase_display (vdid, row, col, end_row, end_col)
  834. WINDOWid       vdid;
  835. int            row;
  836. int            col;
  837. int            end_row;
  838. int            end_col;
  839. {
  840. char           blanks[80];
  841. int        i,j;
  842. wattrset(vdid, A_NORMAL);
  843. for(j=row; j<=end_row; j++)
  844.     {
  845.     for(i=col; i<=end_col; i++)
  846.        blanks[i-col] = ' ';
  847.     blanks[end_col-col+1] = '\0';
  848.     mvwaddstr(vdid, j, col, blanks);
  849.     }
  850. if(UPDATE_WINDOW)wrefresh(vdid);
  851. }
  852. void set_cursor_rel(vdid, num_rows, num_cols)
  853. WINDOWid       vdid;
  854. int    num_rows;
  855. int    num_cols;
  856. {
  857. short curx,cury;
  858. #if defined(unix) | defined(__MSDOS__)
  859. curx = vdid->_curx;
  860. cury = vdid->_cury;
  861. #endif
  862. wmove(vdid, cury+num_rows, curx+num_cols);
  863. if(UPDATE_WINDOW)wrefresh(vdid);
  864. }
  865. void set_physical_cursor(row, col)
  866. int    row;
  867. int    col;
  868. {
  869. wmove(curscr, row, col);
  870. wrefresh(curscr);
  871. }
  872. void get_physical_cursor(row, col)
  873. int    *row;
  874. int    *col;
  875. {
  876. int    prow, pcol;
  877. getyx(curscr, prow, pcol);
  878. *row = prow;
  879. *col = pcol;
  880. }
  881. void return_cursor_pos(vdid, row, col)
  882. WINDOWid       vdid;
  883. int    *row;
  884. int    *col;
  885. {
  886. int    vrow, vcol;
  887. getyx(vdid, vrow, vcol);
  888. *row = vrow;
  889. *col = vcol;
  890. }
  891. /* save_screen()
  892. {
  893. char dumpfile[60];
  894. sprintf(dumpfile, "/tmp/Screen.%d", getpid());
  895. scr_dump(dumpfile);
  896. werase(stdscr);
  897. scrollok(stdscr, TRUE);
  898. wrefresh(stdscr);
  899. }
  900. restore_screen()
  901. {
  902. char dumpfile[60];
  903. sprintf(dumpfile, "/tmp/Screen.%d", getpid());
  904. wrefresh(stdscr);
  905. scrollok(stdscr, FALSE);
  906. erase();
  907. refresh();
  908. scr_restore(dumpfile);
  909. refresh();
  910. unlink(dumpfile);
  911. } */
  912. #endif
  913.  
  914.